#ifndef INTERFACE_H_
#define INTERFACE_H_

/*
console_out_P("HELP -> ABOUT");
console_out_P(" ");
console_out_P(" ");
console_out_P(" : Current Terminal Commands :");
console_out_P(" ");
console_out_P("\t?\t- Help/About:\tThis screen.");
onsole_out_P("\tC\t- Target Info:\tDumps information about target. Such as identification code, fusebits, lockbits, and more.");
console_out_P("\tc\t- Target Memory Test:\tRuns a test to see if the chip has been programmed, including dumping a few lines of hex from target.");
console_out_P("\tE\t- Target Erase:\tSends an ERASE CHIP command to target, will erase depending on lockbits. <WARNING- NO BACKOUT/CANCEL>");
console_out_P("\tl\t- EEPROM Memory Test:\tThis runs a memory test on the external EEPROM; including dumping a few lines of hex.");
console_out_P("\tP\t- Target Program:\tUploades a simple PORTD LED flash hex script to target, may not with with every AVR (for attiny2313). <WARNING- NO BACKOUT/CANCEL>");

 *
 */

/* Version and Hardware Informational Strings */
#define _APP_TITLE_ "AVRSpy_"
#define _APP_CMDLINE_NAME_ "AVRSpy_"
#define _APP_VER_ "1.0"
#define _APP_REV_ "10"
#define _APP_AUTH_ "Brent C. Reamer"

#define _HARD_REV_ "1a"

#define _UART_VER_ "1a"

#define M_CPU "Atmega32"
#define S_CPU "14.7456"

/* Settings */
#define UART_BAUD_RATE 115200

// Device Settings

#define DEVICE_MIN 0		// The EEPROM's start address (usually 0)
#define DEVICE_MAX 0x7FFF	// The EEPROM's last byte address; the 256K is acutally 32767 (0x7FFF). See the datasheet for details.
#define DEVICE_ID 0xA0
#define EEPROM_ID 0xA0


#define TERMINAL_BRAYS 1

/* Misc Interface Variables */
#define EXIT_SAFEMODE_CHAR '!'
#define EXIT_SAFEMODE_PIN PD6
#define EXIT_SAFEMODE_DDR DDRD
#define EXIT_SAFEMODE_PORT PORTD
#define EXIT_SAFEMODE_LED_READY (EXIT_SAFEMODE_DDR |= (1<<EXIT_SAFEMODE_PIN))
#define EXIT_SAFEMODE_LED_OFF (EXIT_SAFEMODE_PORT &= ~(1<<EXIT_SAFEMODE_PIN))
#define EXIT_SAFEMODE_LED_ON (EXIT_SAFEMODE_PORT |= (1<<EXIT_SAFEMODE_PIN))

#define EXTERNAL_CLOCK_PIN PD5
#define EXTERNAL_CLOCK_DDR DDRD
#define EXTERNAL_CLOCK_PORT PORTD
#define EXTERNAL_CLOCK_OFF (EXTERNAL_CLOCK_DDR &= ~(1<<EXTERNAL_CLOCK_PIN)); (EXTERNAL_CLOCK_PORT &= ~(1<<EXTERNAL_CLOCK_PIN))
#define EXTERNAL_CLOCK_ON (EXTERNAL_CLOCK_DDR |= (1<<EXTERNAL_CLOCK_PIN)); (EXTERNAL_CLOCK_PORT |= (1<<EXTERNAL_CLOCK_PIN))


/* Menu Commands and Descriptions */

#define CMD_FILL_EEPROM 'F'
#define TXT_FILL_EEPROM "Enables FILL EEPROM Mode."

#define CMD_TARGET_INFO 'i'
#define TXT_TARGET_INFO "Dumps information about target."

#define CMD_HELP '?'
#define TXT_HELP "This screen."

#define CMD_TARGET_MEMDUMP 'd'
#define TXT_TARGET_MEMDUMP "Dump target's program memory."

#define CMD_TARGET_ERASE 'E'
#define TXT_TARGET_ERASE "Erase Target Device (ALL)."

#define CMD_EXTERNAL_CLOCK 'C'
#define TXT_EXTERNAL_CLOCK "Enable 2Mhz external clock source."

#define CMD_EEPROM_ERASE 'e'
#define TXT_EEPROM_ERASE "Erase External EEPROM."

#define CMD_EEPROM_DUMP 'D'
#define TXT_EEPROM_DUMP "Test&Dump External EEPROM Memory."

#define CMD_PROG_TARGET 'P'
#define TXT_PROG_TARGET "Program target with External EEPROM"

unsigned char* cmds[]=
	{
			CMD_HELP,

			CMD_TARGET_INFO,
			CMD_TARGET_ERASE,
			CMD_TARGET_MEMDUMP,
			CMD_PROG_TARGET,

			CMD_EXTERNAL_CLOCK,

			CMD_EEPROM_ERASE,
			CMD_EEPROM_DUMP,
			CMD_FILL_EEPROM,
	};

char* help[]=
	{
			TXT_HELP,

			TXT_TARGET_INFO,
			TXT_TARGET_ERASE,
			TXT_TARGET_MEMDUMP,
			TXT_PROG_TARGET,

			TXT_EXTERNAL_CLOCK,

			TXT_EEPROM_ERASE,
			TXT_EEPROM_DUMP,
			TXT_FILL_EEPROM,
	};

#endif /* INTERFACE_H_ */
